/*
 * @(#)MaintSysUserDefinedIndexForm.java
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */
package com.dcivision.framework.web;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;

import com.dcivision.framework.ApplicationException;
import com.dcivision.framework.TextUtility;
import com.dcivision.framework.bean.AbstractBaseObject;
import com.dcivision.framework.bean.SysUserDefinedIndex;

/**
  MaintSysUserDefinedIndexForm.java

  This class is the for web form purpose.

  @author      Zoe Shum
  @company     DCIVision Limited
  @creation date   15/10/2003
  @version     $Revision: 1.9 $
*/

public class MaintSysUserDefinedIndexForm extends AbstractActionForm {

  public static final String REVISION = "$Revision: 1.9 $";

  private String parentID = null;
  private String objectType = null;
  private String userDefinedType = null;
  private String description = null;
  private String genKeyTemplate = null;
  private String genKeyNumMax = null;
  private String importType = null;
  private String workflowRecordID = null;
  private String dmsParentID = null;
  private String dmsRootID = null;
  private String dmsScanFolderPath = null;
  private String dmsScanFolderCreationType = null;

  private List userDetailList=null;

  private String userDefinedFieldDetailID = null;
  private String fieldValue = null;

  public MaintSysUserDefinedIndexForm() {
    super();
  }

  public String getParentID() {
    return(this.parentID);
  }

  public void setParentID(String parentID) {
    this.parentID = parentID;
  }

  public String getObjectType() {
    return(this.objectType);
  }

  public void setObjectType(String objectType) {
    this.objectType = objectType;
  }

  public String getUserDefinedType() {
    return(this.userDefinedType);
  }

  public void setUserDefinedType(String userDefinedType) {
    this.userDefinedType = userDefinedType;
  }

  public String getDescription() {
    return(this.description);
  }

  public void setDescription(String description) {
    this.description = description;
  }

  public String getGenKeyTemplate() {
    return(this.genKeyTemplate);
  }

  public void setGenKeyTemplate(String genKeyTemplate) {
    this.genKeyTemplate = genKeyTemplate;
  }

  public String getGenKeyNumMax() {
    return(this.genKeyNumMax);
  }

  public void setGenKeyNumMax(String genKeyNumMax) {
    this.genKeyNumMax = genKeyNumMax;
  }

  public String getImportType() {
    return(this.importType);
  }

  public void setImportType(String importType) {
    this.importType = importType;
  }

  public String getWorkflowRecordID() {
    return(this.workflowRecordID);
  }

  public void setWorkflowRecordID(String workflowRecordID) {
    this.workflowRecordID = workflowRecordID;
  }

  public String getDmsParentID() {
    return(this.dmsParentID);
  }

  public void setDmsParentID(String dmsParentID) {
    this.dmsParentID = dmsParentID;
  }

  public String getDmsRootID() {
    return(this.dmsRootID);
  }

  public void setDmsRootID(String dmsRootID) {
    this.dmsRootID = dmsRootID;
  }

  public String getDmsScanFolderPath() {
    return(this.dmsScanFolderPath);
  }

  public void setDmsScanFolderPath(String dmsScanFolderPath) {
    this.dmsScanFolderPath = dmsScanFolderPath;
  }

  public String getDmsScanFolderCreationType() {
    return(this.dmsScanFolderCreationType);
  }

  public void setDmsScanFolderCreationType(String dmsScanFolderCreationType) {
    this.dmsScanFolderCreationType = dmsScanFolderCreationType;
  }

  public void setUserDetailList(List DetailList) {
    this.userDetailList = DetailList;
  }

  public List getUserDetailList() {
    return (this.userDetailList);
  }

  public String getUserDefinedFieldDetailID() {
    return(this.userDefinedFieldDetailID);
  }

  public void setUserDefinedFieldDetailID(String userDefinedFieldDetailID) {
    this.userDefinedFieldDetailID = userDefinedFieldDetailID;
  }

  public String getFieldValue() {
    return(this.fieldValue);
  }

  public void setFieldValue(String fieldValue) {
    this.fieldValue = fieldValue;
  }

  public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
    return super.validate(mapping, request);
  }

  public void reset(ActionMapping mapping, HttpServletRequest request) {
    super.reset(mapping, request);
    this.setID(null);
    this.setParentID(null);
    this.setObjectType(null);
    this.setUserDefinedType(null);
    this.setDescription(null);
    this.setGenKeyTemplate(null);
    this.setGenKeyNumMax(null);
    this.setImportType(null);
    this.setWorkflowRecordID(null);
    this.setDmsParentID(null);
    this.setDmsRootID(null);
    this.setDmsScanFolderPath(null);
    this.setDmsScanFolderCreationType(null);
    this.setRecordStatus(null);
    this.setUpdateCount(null);
    this.setCreatorID(null);
    this.setCreateDate(null);
    this.setUpdaterID(null);
    this.setUpdateDate(null);
    this.setUserDetailList(null);
    request.setAttribute("listSize", null);
    request.setAttribute("newFieldsSize", null);
    request.setAttribute("newField", null);

  }

  public AbstractBaseObject getFormData() throws ApplicationException {
    SysUserDefinedIndex tmpSysUserDefinedIndex = new SysUserDefinedIndex();
    tmpSysUserDefinedIndex.setID(TextUtility.parseIntegerObj(this.getID()));
    tmpSysUserDefinedIndex.setParentID(TextUtility.parseIntegerObj(this.getParentID()));
    tmpSysUserDefinedIndex.setObjectType(this.getObjectType());
    tmpSysUserDefinedIndex.setUserDefinedType(this.getUserDefinedType());
    tmpSysUserDefinedIndex.setDescription(this.getDescription());
    tmpSysUserDefinedIndex.setGenKeyTemplate(this.getGenKeyTemplate());
    tmpSysUserDefinedIndex.setGenKeyNumMax(TextUtility.parseIntegerObj(this.getGenKeyNumMax()));
    tmpSysUserDefinedIndex.setImportType(this.getImportType());
    tmpSysUserDefinedIndex.setWorkflowRecordID(TextUtility.parseIntegerObj(this.getWorkflowRecordID()));
    tmpSysUserDefinedIndex.setDmsParentID(TextUtility.parseIntegerObj(this.getDmsParentID()));
    tmpSysUserDefinedIndex.setDmsRootID(TextUtility.parseIntegerObj(this.getDmsRootID()));
    tmpSysUserDefinedIndex.setDmsScanFolderPath(this.getDmsScanFolderPath());
    tmpSysUserDefinedIndex.setDmsScanFolderCreationType(this.getDmsScanFolderCreationType());
    tmpSysUserDefinedIndex.setRecordStatus(this.getRecordStatus());
    tmpSysUserDefinedIndex.setUpdateCount(TextUtility.parseIntegerObj(this.getUpdateCount()));
    tmpSysUserDefinedIndex.setCreatorID(TextUtility.parseIntegerObj(this.getCreatorID()));
    tmpSysUserDefinedIndex.setCreateDate(parseTimestamp(this.getCreateDate()));
    tmpSysUserDefinedIndex.setUpdaterID(TextUtility.parseIntegerObj(this.getUpdaterID()));
    tmpSysUserDefinedIndex.setUpdateDate(parseTimestamp(this.getUpdateDate()));
    return tmpSysUserDefinedIndex;
  }

  public void setFormData(AbstractBaseObject baseObj) throws ApplicationException {
    SysUserDefinedIndex tmpSysUserDefinedIndex = (SysUserDefinedIndex)baseObj;
    this.setID(TextUtility.formatIntegerObj(tmpSysUserDefinedIndex.getID()));
    this.setParentID(TextUtility.formatIntegerObj(tmpSysUserDefinedIndex.getParentID()));
    this.setObjectType(tmpSysUserDefinedIndex.getObjectType());
    this.setUserDefinedType(tmpSysUserDefinedIndex.getUserDefinedType());
    this.setDescription(tmpSysUserDefinedIndex.getDescription());
    this.setGenKeyTemplate(tmpSysUserDefinedIndex.getGenKeyTemplate());
    this.setGenKeyNumMax(TextUtility.formatIntegerObj(tmpSysUserDefinedIndex.getGenKeyNumMax()));
    this.setImportType(tmpSysUserDefinedIndex.getImportType());
    this.setWorkflowRecordID(TextUtility.formatIntegerObj(tmpSysUserDefinedIndex.getWorkflowRecordID()));
    this.setDmsParentID(TextUtility.formatIntegerObj(tmpSysUserDefinedIndex.getDmsParentID()));
    this.setDmsRootID(TextUtility.formatIntegerObj(tmpSysUserDefinedIndex.getDmsRootID()));
    this.setDmsScanFolderPath(tmpSysUserDefinedIndex.getDmsScanFolderPath());
    this.setDmsScanFolderCreationType(tmpSysUserDefinedIndex.getDmsScanFolderCreationType());
    this.setRecordStatus(tmpSysUserDefinedIndex.getRecordStatus());
    this.setUpdateCount(TextUtility.formatIntegerObj(tmpSysUserDefinedIndex.getUpdateCount()));
    this.setCreatorID(TextUtility.formatIntegerObj(tmpSysUserDefinedIndex.getCreatorID()));
    this.setCreateDate(formatTimestamp(tmpSysUserDefinedIndex.getCreateDate()));
    this.setUpdaterID(TextUtility.formatIntegerObj(tmpSysUserDefinedIndex.getUpdaterID()));
    this.setUpdateDate(formatTimestamp(tmpSysUserDefinedIndex.getUpdateDate()));
  }

  public List getFormFieldData() throws ApplicationException {
    List tmpDetailList = this.getUserDetailList();
    return tmpDetailList;
  }

  public void setFormListData(List detailList) throws ApplicationException {
    List userDetailList = detailList;
    this.setUserDetailList(userDetailList);
  }

}
